<template>
  <div>
    <el-container style="height: 1500px">
      <el-header
      ><span>智能平台</span>
        <el-button
            type="danger"
            icon="el-icon-error"
            circle
            class="loginout"
            @click="logout"
        ></el-button>
      </el-header>
      <el-container>
        <el-aside width="200px">
          <el-col :span="24">
            <el-menu
                :default-active="this.$router.path"
                class="el-menu-vertical-demo"
                background-color="#545c64"
                text-color="#fff"
                @open="handleOpen"
                active-text-color="#ffd04b"
                router
            >
              <el-submenu index="1">
                <template slot="title">
                  <i class="el-icon-user"></i>
                  <span>班级学员管理</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="#">班级管理</el-menu-item>
                  <el-menu-item index="#">学院管理</el-menu-item>
                </el-menu-item-group>
              </el-submenu>
              <el-submenu index="2">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>系统信息管理</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="/index/dept">部门管理</el-menu-item>
                  <el-menu-item index="/index/emp">员工管路</el-menu-item>
                </el-menu-item-group>
              </el-submenu>
              <el-submenu index="3">
                <template slot="title">
                  <i class="el-icon-data-board"></i>
                  <span>数据统计管理</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="#">员工数据统计</el-menu-item>
                </el-menu-item-group>
              </el-submenu>
            </el-menu>
          </el-col>
        </el-aside
        >
        <el-main>
          <h1 v-if="$store.state.isshow">欢迎进入智能辅助平台</h1>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import request from '../utils/request';

export default {
  name: 'IndexHtml',
  methods: {
    handleOpen(key, keyPath) {
      this.$store.state.isshow = false;
      console.log(key, keyPath);
    },
    logout() {
      this.$confirm('是否退去登录?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
          .then(() => {
            localStorage.removeItem('token');
            request.get('#');
            this.$message({
              type: 'success',
              message: '退出成功!',
            });
          })
          .catch(() => {
            this.$message({
              type: 'info',
              message: '退出失败',
            });
          });
    },
  },

};
</script>

<style scoped>
.block {
  float: right;
}

.loginout,
span {
  display: inline;
}

.loginout {
  float: right;
  margin-top: 10px;
}

.el-header {
  background-color: #b3c0d1;
  color: #b92b2b;
  text-align: center;
  line-height: 60px;
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 50px;
  display: inline-block;
}

.el-aside {
  line-height: 200px;
  margin-top: 10px;
  background-color: #c2c9d3;
}

.el-main {
  margin-top: 10px;
  background-color: #e9eef3;
  color: #754040;
  text-align: center;
  line-height: 160px;
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: xx-large;
}

body > .el-container {
  margin-bottom: 40px;
  padding: 5px;
  margin: 10px;
}

.el-menu {
  border: none;
  border-right-width: 0;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>
